package com.zy.util;

import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;

import org.dom4j.Document;
import org.dom4j.io.XMLWriter;

public class Dom4jWriteXml {
	public static void writeXml(String xmlUrl,Document doc)throws IOException {
		//创建一个文件对象
		File file = new File(xmlUrl);
		//创建一个操作文件的字节输出流
		FileOutputStream fos = new FileOutputStream(file);
		//创建写入XML的流对象
		XMLWriter writer = new XMLWriter(fos);
		//写入到xml文件
		writer.write(doc);
		//关闭流对象
		writer.close();
	}
}
